<!--
 * @Descripttion: 下载插件提示
 * @version: V1.0
 * @Author: GW
 * @Date: 2021-11-16 09:53:26
 * @LastEditors: GW
 * @LastEditTime: 2022-01-06 10:39:16
-->
<template>
    <a-modal title="打印提示" :visible="visible" :confirm-loading="confirmLoading" @ok="handleOk" @cancel="handleCancel" :closable="false">

        <p style="text-align:center;font-weight:bold;letter-spacing:1px;height:180px;padding-top:80px;">
            <span style="color:#dc3545;font-size:16px;"> 您还未安装打印插件，请下载安装插件<br>下载安装完成后请刷新页面!</span>
            <!-- <a-icon type="exclamation" style="font-size:26px;color:#dc3545" /> -->
        </p>
        <template slot="footer">
            <a-button type="primary" @click="down">下载</a-button>
            <a-button type="primary" @click="handleCancel">稍后下载</a-button>
        </template>
    </a-modal>
</template>

<script>
import { getLodop } from "@/utils/tool/LodopFun"
import { downLoadexe } from "@/api/inventory/barcode";
export default {
    data () {
        return {
            visible: false,
            confirmLoading: false,
        }
    },
    methods: {
        down () {
            //下载插件
            downLoadexe().then(res => {
                if (res.code === 200) {
                    window.location.href = res.message;
                    this.visible = false;
                }
            })
        },
        CheckIsInstall () {
            try {
                let LODOP = getLodop();
                if (LODOP.VERSION) {
                    if (LODOP.CVERSION) {
                        console.log("当前有WEB打印服务C-Lodop可用!\n C-Lodop版本:" + LODOP.CVERSION + "(内含Lodop" + LODOP.VERSION + ")");
                    } else {
                        console.log("本机已成功安装了Lodop控件！\n 版本号:" + LODOP.VERSION);
                    }
                };
                this.visible = false;
            } catch (err) {
                this.visible = true;
            }
            return this.visible;
        },
        handleCancel () {
            this.visible = false;
        },
    }
}
</script>
<style>
</style>